<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../../include/admincontent.jsp" %>
<div id="location">当前位置：招聘实施管理 > 面试批次管理</div>

<div id="Content">
    <div class="tabbar">
        <a class="current">面试批次</a>
        <a id="btn_msbatchuser">批次人员</a>
        <a id="btn_msenclosure" style="display: none">批次附件</a>
    </div>
    <!-- 筛选条件 -->
    <div id="searchbox">
        <form id="searchform">
            <table class="treeTable searchform">
                <thead>
                <tr>
                    <td width="60">批次号：</td>
                    <td width="150">
                        <div><input type="text" name="mspch"></div>
                    </td>
                    <td width="60">面试地点：</td>
                    <td width="150">
                        <div><input type="text" name="msaddress"></div>
                    </td>
                    <td width="60">面试时间：</td>
                    <td width="150">
                        <div><input type="text" name="msstarttime"></div>
                    </td>

                    <td width="60">
                        面试方案:
                    </td>
                    <td width="150">
                        <div><input type="text" name="pname"></div>
                    </td>
                    <td width="60">
                        方案类型:
                    </td>
                    <td width="150">
                        <div><select name="recruittype">
                            <option value="">全部</option>
                            <option value="3">社招</option>
                            <option value="1">校招</option>
                            <option value="2">中专</option>
                            <%--                    <option value="4">内部</option>--%>
                        </select></div>
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <td width="60">身份证号：</td>
                    <td width="150">
                        <div><input type="text" name="ucardno"></div>
                    </td>
                    <td width="60">姓名：</td>
                    <td width="150">
                        <div><input type="text" name="uname"></div>
                    </td>
                    <td width="60">附件名称：</td>
                    <td width="150">
                        <div><input type="text" name="filename"></div>
                    </td>

                    <td width="60">
                        面试岗位：
                    </td>
                    <td width="150">
                        <div><input type="text" name="jname"/></div>
                    </td>
                    <td colspan="2">
                        <div class="toolbars">
                            <a id="searchbtn">
                                <em class="ico16 search_16"></em>
                                <span class="menu_span" title="查询">查询</span>
                            </a>
                            <a id="clearbtn">
                                <em class="ico16 del_16"></em>
                                <span class="menu_span" title="清除">清除</span>
                            </a>
                        </div>
                    </td>
                    <td></td>
                </tr>
                </thead>
            </table>
        </form>
    </div>

    <%--    <table class="treeTable" id="tablelist">--%>
    <%--        <thead>--%>
    <%--        <tr>--%>
    <%--            <td width="20"><input type="checkbox" class="allcheckbox" title="选择全部/取消全选"/></td>--%>
    <%--            <td width="30">序号</td>--%>
    <%--            <td width="320">面试批次号</td>--%>
    <%--            <td style="display: none">方案ID</td>--%>
    <%--            <td width="160">方案名称</td>--%>
    <%--            <td width="60">方案类型</td>--%>
    <%--            <td  style="display: none">面试岗位ID</td>--%>
    <%--            <td  width="100">面试岗位</td>--%>
    <%--            <td width="150">面试地点</td>--%>
    <%--            <td width="100">面试时间</td>--%>
    <%--            <td width="80">参加人数</td>--%>
    <%--            <td width="80">已上传附件数</td>--%>
    <%--            <td width="50">操作</td>--%>
    <%--        </tr>--%>
    <%--        </thead>--%>
    <%--        <tbody id="result"></tbody>--%>
    <%--    </table>--%>
    <%--    <div id="page"></div>--%>
</div>
<div style="overflow:hidden;">
    <div id="div_table" style="bottom: 0px">
        <table class="layui-hide" id="table" lay-filter="msbatchTable"></table>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        // getList();
        let reload;
        layui.use('table', () => {
            let table = layui.table;
            table.render({
                id: 'table'
                , elem: '#table'
                , height: 'full'
                , url: '/Do/MS/queryMsBatchJson?' + $("#searchform").serialize()//数据接口
                , title: '用户表'
                , page: true //开启分页
                , cols: [[ //表头
                    {type: 'checkbox', fixed: 'left', width: 50}
                    , {type: 'numbers', title: '序号', width: '10%', sort: true}
                    , {field: 'mspch', title: '面试批次号', width: '10%', sort: true}
                    , {field: 'pname', title: '方案名称', width: '10%', sort: true}
                    , {field: 'type', title: '方案类型', width: '10%', sort: true}
                    , {field: 'jname', title: '面试岗位', width: '10%', sort: true}
                    , {field: 'address', title: '面试地点', width: '10%', sort: true}
                    , {field: 'starttime', title: '面试时间', width: '10%', sort: true}
                    , {field: 'mspcrs', title: '参加人数', width: '10%', sort: true}
                    , {field: 'msfjgs', title: '已上传附件数', width: '10%', sort: true}
                    , {
                        field: 'remark', title: '操作', width: '10%', templet: (d) => {
                            let rqs = "mspch=\'" + d.mspch + "\'&pid=\'" + d.pid + "\'&pname=\'" + d.pname +
                                "\'&jid=\'" + d.jid + "\'&jname=\'" + d.jname + "\'";
                            rqs = "mspch=" + encodeURIComponent(d.mspch) + "&pid=" + encodeURIComponent(d.pid) +
                                    "&pname=" + encodeURIComponent(d.pname) + "&jid=" + encodeURIComponent(d.jid) +
                                    "&jname=" + encodeURIComponent(d.jname);
                            return "<a onClick=userDetial(\"" + rqs + "\") style='color:#2b72dc;'>人员详情</a>" +
                                    "<span>&nbsp;/&nbsp;</span>" +
                                "<a style='color:#2b72dc;' onClick=enclosureDetial(\"" + rqs + "\")>附件详情</a>";
                        }
                    }
                ]]
            });
            reload = () => {
                table.reload('table');
            }
            document.tablereload = reload;
            $("#searchbtn").on('click', () => {
                table.reload('table', {
                    url: '/Do/MS/queryMsBatchJson?' + $("#searchform").serialize()//数据接口
                    , page: {
                        curr: 1
                    }
                })
            })
        });
        $('#btn_msenclosure').hide();

        // $('#searchbtn').click(function () {
        //     getList();
        // });

        $('#btn_msbatchuser').click(function () {
            $('#btn_msenclosure').hide();
            var checkRows = $('.allcheckbox').data("checkIds");
            var row = $('#result').find("tr.checked");
            var pid = $(row).find("td:eq(3)").html();
            var pname = $(row).find("td:eq(4)").html();
            var jid = $(row).find("td:eq(7)").html();
            var jname = $(row).find("td:eq(6)").html();
            if (!!checkRows) {
                var ids = "";
                $(checkRows).each(function (index, itme) {
                    ids += itme.replace('cb_', '') + ",";
                });
                ids = ids.substring(0, ids.length - 1);
                location.href = "/Do/MS/msbatchuser?mspch=" + ids + "&pid=" + pid + "&pname=" + pname + "&jid=" + jid + "&jname=" + jname;
            } else {
                location.href = "/Do/MS/msbatchuser";
            }

        });
        $('#btn_msenclosure').click(function () {
            $('#btn_msenclosure').show();
            var checkRows = $('.allcheckbox').data("checkIds");
            var row = $('#result').find("tr.checked");
            var pid = $(row).find("td:eq(3)").html();
            var pname = $(row).find("td:eq(4)").html();
            var jid = $(row).find("td:eq(7)").html();
            var jname = $(row).find("td:eq(6)").html();

            //console.log(pid+":"+pname+"=="+jid+":"+jname);
            if (!!checkRows) {
                var ids = "";

                $(checkRows).each(function (index, itme) {
                    ids += itme.replace('cb_', '') + ",";
                });
                ids = ids.substring(0, ids.length - 1);
                location.href = "/Do/MS/msenclosure?mspch=" + ids + "&pid=" + pid + "&pname=" + pname + "&jid=" + jid + "&jname=" + jname;
            } else {
                location.href = "/Do/MS/msenclosure";
            }
        })
    });

    function getList() {
        $('#page').myPagination({
            cssStyle: "pagination",
            singleCheck: true,
            saveChecked: true,
            ajax: {
                on: true,
                param: $("#searchform").serialize(),
                url: '/Do/MS/queryMsBatch',
                dataType: 'html',
                callback: function (data) {
                    $('#result').html(data);
                }
            }
        });
        $('#btn_msenclosure').hide();

    }

    function userDetial(rqs) {
        // var row = $(event).parent().parent();
        // var mspch = $(row).find("td:eq(2)").html();
        // var pid = $(row).find("td:eq(3)").html();
        // var pname = $(row).find("td:eq(4)").html();
        // var jid = $(row).find("td:eq(7)").html();
        // var jname = $(row).find("td:eq(6)").html();
        // location.href = "/Do/MS/msbatchuser?mspch=" + mspch + "&pid=" + pid + "&pname=" + pname + "&jid=" + jid + "&jname=" + jname;
        location.href = "/Do/MS/msbatchuser?" + rqs;
    }

    function enclosureDetial(rqs) {
        // var row = $(event).parent().parent();
        // var mspch = $(row).find("td:eq(2)").html();
        // var pid = $(row).find("td:eq(3)").html();
        // var pname = $(row).find("td:eq(4)").html();
        // var jid = $(row).find("td:eq(7)").html();
        // var jname = $(row).find("td:eq(6)").html();
        //console.log(pid+":"+pname+"=="+jid+":"+jname);
        // location.href = "/Do/MS/msenclosure?mspch=" + mspch + "&pid=" + pid + "&pname=" + pname + "&jid=" + jid + "&jname=" + jname;
        location.href = "/Do/MS/msenclosure?" + rqs;
    }
</script>
</body>
</html>